package msl.ConAR;

import java.util.*;

import android.app.Activity;
import android.content.*;
import android.os.Bundle;
import android.view.*;
import android.widget.*;
import msl.ConAR.*;
import msl.ConAR.R.*;


public class ProfileTab extends Activity{
	ArrayList<MyProfile> arProfile;
	ArrayAdapter<String> Adapter;
	ListView list;
	
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.profile);
	
		arProfile = new ArrayList<MyProfile>();
		MyProfile mprofile;
		
		mprofile=new MyProfile("Name", "Heakwang Lee"); arProfile.add(mprofile);
		mprofile=new MyProfile("Degree", "B.S"); arProfile.add(mprofile);
		mprofile=new MyProfile("Research", "Mobile Platform"); arProfile.add(mprofile);
		mprofile=new MyProfile("Projects", "Star Apps"); arProfile.add(mprofile);
		mprofile=new MyProfile("Privacy", "Off"); arProfile.add(mprofile);
		
		ImageView img=(ImageView)findViewById(R.id.pfImg);
		img.setImageResource(R.drawable.pf_lhk);
		
		MyProfileAdapter MyAdapter=new MyProfileAdapter(
				this, R.layout.profilelist, arProfile);
		
		ListView MyList;
		MyList=(ListView)findViewById(R.id.pflist);
		MyList.setAdapter(MyAdapter);
		
	}
}


class MyProfile{
	MyProfile(String aAttribute, String aValue){
		Attribute=aAttribute;
		Value=aValue;
	
	}
	
	String Attribute;
	String Value;

}



class MyProfileAdapter extends BaseAdapter{
	
	Context maincon;
	LayoutInflater Inflater;
	ArrayList<MyProfile> arSrc;
	int layout;
	
	public MyProfileAdapter(Context context, int alayout, ArrayList<MyProfile> aarSrc){
		maincon=context;
		Inflater=(LayoutInflater)context.getSystemService(
				Context.LAYOUT_INFLATER_SERVICE);
		
		arSrc=aarSrc;
		layout=alayout;
	}
	
	public int getCount(){
		return arSrc.size();
	}
	
	public String getItem(int position){
		return arSrc.get(position).Attribute;
		
	}

	public long getItemId(int position){
		return position;
	}
	
	//뷰 생성
	public View getView(int position, View convertView, ViewGroup parent){
		final int pos=position;
		if(convertView==null){
			convertView=Inflater.inflate(layout, parent, false);
		}
		
		TextView txtAttribute=(TextView)convertView.findViewById(R.id.pfAttributeText);
		txtAttribute.setText(arSrc.get(position).Attribute);
		
		TextView txtValue=(TextView)convertView.findViewById(R.id.pfValueText);
		txtValue.setText(arSrc.get(position).Value);
		
			
		return convertView;
				
	}
}
